package com.bailanzu.xian;
import com.bailanzu.tool.ToneScissorClothImpl;

import java.util.Scanner;
import java.util.Random;
import java.util.function.DoubleToIntFunction;
public class Game {
    public static void main(String[] args) {
        //通过Random类中的nextInt (int n)方法，生成1-3的随机数 1代表石头 2代表剪刀 3代表布
        int a=0,b=0;//a代表人赢的次数，b代表电脑赢的次数
        System.out.println("程序已启动");
        System.out.println("石头剪刀布");
        System.out.println("输入石头，剪刀，布");
        System.out.println("请输入所要进行的对局数：");
        Scanner sc =new Scanner(System.in);
        int number = sc.nextInt();

        for(int i=1;i<=number;i++)
        {
            System.out.println("第"+i+"局");
            Scanner enter = new Scanner(System.in);
            String equals=enter.next();

            int randomNumber =new Random().nextInt(3)+1;//输出1代表剪刀，2代表石头，3代表布

            ToneScissorClothImpl n=new ToneScissorClothImpl();

           if (n.gameStandard(equals,  randomNumber)==1)
           {
               a++;
           }
           else if (n.gameStandard(equals,  randomNumber)==2)
           {
               b++;
           }
            else if (n.gameStandard(equals,  randomNumber)==0) {

               System.out.println("出错了");
               i--;
           }

        }
        System.out.println("共进行了"+number+"局游戏，你赢了"+a+"局，输了"+b+"局");



    }

}
